package com.work.mybatis;

import com.work.mybatis.annotations.User;
import com.work.mybatis.factory.MapperProxyFactory;
import com.work.mybatis.handler.IntegerTypeHandler;
import com.work.mybatis.handler.StringTypeHandler;
import com.work.mybatis.mapper.TypeHandler;
import com.work.mybatis.mapper.UserMapper;

import javax.sql.DataSource;
import java.io.IOException;
import java.io.InputStream;
import java.sql.*;
import java.util.*;
//类型处理器，sql给变量赋值的时候，到底是setString，还是setInt,还是别的类型


public class MybatisApplication {


    public static void main(String[] args) {
        UserMapper userMapper = MapperProxyFactory.getMapper(UserMapper.class);
        List<User> list = userMapper.getUserName("白上二影");
        System.out.println("--------sql查询1返回--------" + list);
//        User user = userMapper.getUserById(2);
//        System.out.println("--------sql查询2返回--------" + user);
//        String name = userMapper.getUserNameById(2);
//        System.out.println("--------sql查询3返回--------" + name);
//        int insertResult = userMapper.insertUser("白上二影",19);
//        System.out.println("--------sql新增1返回--------" + insertResult);
//
//        List<User> list = userMapper.getUserName("白上二影");
//        System.out.println("--------sql查询2返回--------" + list);
//        List<User> allUser = userMapper.getAllUser();
//        System.out.println("--------sql查询3返回--------" + allUser);
//        int updateResult = userMapper.updateUserById("陈陈陈",22,9);
//        System.out.println("--------sql修改1返回--------" + updateResult);
//        int deleteResult = userMapper.deleteUserById(18);
//        System.out.println("--------sql删除1返回--------" + deleteResult);


    }

}
